package com.zyg.demo.entity;

import android.animation.ObjectAnimator;
import android.support.v7.widget.RecyclerView;

import com.zyg.demo.entity.AnimItem;

/**
 * @author zhengyunguang
 * created at 2019-07-10 17:36
 */
public class FolderBgHideItem extends AnimItem {

    private ObjectAnimator animator;

    public FolderBgHideItem(RecyclerView.ViewHolder viewHolder, int pos, float initalScale) {
        super(viewHolder, pos);
        scale = initalScale;
        animator = ObjectAnimator.ofFloat(this, "scale", scale, .0f);
    }

    public void hide() {
        animator.setDuration(200);
        animator.setAutoCancel(true);
//        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
//            @Override
//            public void onAnimationUpdate(ValueAnimator animation) {
//                JLog.d("animation.getValue = " + animation.getAnimatedValue());
//                JLog.d("viewHolder = " + viewHolder);
//                if (viewHolder != null) {
//                    viewHolder.itemView.invalidate();
//                }
//            }
//        });
        animator.start();
    }


}
